package com.qf.advice;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

/**
 * 环绕通知:
 *         先执行环绕通知, 例如: 开启事务
 *         再执行核心service中的业务增删改查方法
 *         再执行环绕通知 例如: 提交事务
 *
 * @author
 */
public class MyAroundAdvice implements MethodInterceptor {

    @Override
    public Object invoke(MethodInvocation methodInvocation) throws Throwable {
        System.out.println("======环绕通知: 开启事务MethodInterceptor======");
        Object proceed = methodInvocation.proceed();//调用执行核心service中的业务方法
        System.out.println("======环绕通知: 提交事务MethodInterceptor======");
        return proceed;
    }

}
